package framework.mashup;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.layout.Pane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;

public class JsxGraph extends Pane{
	public JsxGraph() {
		this.setPrefHeight(500);
		this.setPrefWidth(420);
		
		WebView webView = new WebView();
		final WebEngine webEngine = webView.getEngine();
		//URL urlHello = getClass().getResource("JsxGraph.html");
        //webEngine.load(urlHello.toExternalForm());
		webEngine.load("http://restmiyake.appspot.com/JsxGraph.html");
        webView.prefHeightProperty().bind(this.heightProperty());
        webView.prefWidthProperty().bind(this.widthProperty());
        this.getChildren().add(webView);
        Button button = new Button("Load");
//        this.getChildren().add(button);
        button.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
				String key = "12345";
				String points = "5001";
				webEngine.executeScript("document.download(" + key + "," + points + ")");
			}
        	
        });
	}
}
